package com.tbm.console.proj.repository;

import com.tbm.console.base.repository.CommonRepository;
import com.tbm.console.common.constant.SQLConstant;
import com.tbm.console.proj.entity.SystemButton;
import com.tbm.console.proj.entity.SystemRole;
import com.tbm.console.proj.view.SystemButtonMenuView;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface SystemButtonRepository extends CommonRepository<SystemButton> {


    @Query(value="SELECT new com.tbm.console.proj.view.SystemButtonMenuView(b,m)  FROM  SystemButton b, com.tbm.console.proj.entity.SystemMenu m WHERE b.menuID = m.id ")
    List<SystemButtonMenuView> findSystemButtonMenuView(Pageable pageable);

    @Query(value= SQLConstant.SYSTEMROLEBYMENUURL,nativeQuery = true)
    List<SystemButton> findSystemButtonLocalQuery(String menuURL);

}
